
library(stargazer)
pmdb <- read.csv("PMDB.csv")
pp <- read.csv("PP.csv")
pt <- read.csv("PT.csv")

library(dplyr)
library(car)

## Restricting the years to 2003-2015 

pmdb3d <- pmdb %>% filter(Year2 >= 2003 & Year2 < 2015)
pp3d <- pp %>% filter(Year2 >= 2003 & Year2 < 2015)
pt3d <- pt  %>% filter(Year2 >= 2003 & Year2 < 2015)

r26 <- lm(support ~ Elapse + Idrange + PatPayoff + Cabpayoff, pmdb3d)
r27 <- lm(support ~ Elapse + Idrange + PatPayoff + Cabpayoff, pp3d)
r28 <- lm(support ~ Elapse + Idrange + PatPayoff + Cabpayoff, pt3d)
r26.1 <- lm(support ~ Elapse + IDHETERO + PatPayoff + Cabpayoff, pmdb3d)
r27.1 <- lm(support ~ Elapse + IDHETERO + PatPayoff + Cabpayoff, pp3d)
r28.1 <- lm(support ~ Elapse + IDHETERO + PatPayoff + Cabpayoff, pt3d)

stargazer(r26, r27, r28, r26.1, r27.1, r28.1, column.labels = c("PMDB", "PP", "PT", "PMDB", "PP", "PT"),
          title = "Payoff and Sub Ministerial Payoff 2003-2015", no.space=TRUE, omit.stat=c("LL","ser","f"),
          style = "ajps", header = T)


